package br.nom.penha.bruno.controlegastos.form;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;

import br.nom.penha.bruno.controlegastos.midlet.PrincipaMIDlet;

/**
 * @author bruno.penha@gmail.com
 *
 */
public class TelaSaudacao extends Form implements CommandListener {

	private PrincipaMIDlet midlet;
	private Command comandoSaida ;
	
	public TelaSaudacao(PrincipaMIDlet midlet, String saudacao) 
	{
		super("");
		StringItem textoSaudacao = new StringItem("", saudacao);
		super.append(textoSaudacao);
		this.midlet = midlet;
		comandoSaida = new Command("Sair", Command.EXIT,1);
		addCommand(comandoSaida);
		setCommandListener(this);
		
	}

	/* (non-Javadoc)
	 * @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command, javax.microedition.lcdui.Displayable)
	 */
	public void commandAction(Command comando, Displayable visivelTela) {
		
		if(comando == comandoSaida){
			midlet.notifyDestroyed();
		}

	}

}
